Skip to content

Changed to asynchronous test case for loading more results#2020

Merged
joelit merged 4 commits intomainfrom
issue2019-fix-cypress-test-for-load-more-search-results
Apr 24, 2026
Merged

Changed to asynchronous test case for loading more results#2020
joelit merged 4 commits intomainfrom
issue2019-fix-cypress-test-for-load-more-search-results

Conversation

@joelit
Copy link
Copy Markdown
Contributor

@joelit joelit commented Apr 24, 2026

Reasons for creating this PR

The cypress tests are failing for a unit test reoading more search results. This fixes it by changing to a more robust test case for testing the functionality of the same thing.

Link to relevant issue(s), if any

Description of the changes in this PR

Changed to a test case that returns only slightly more than 5 results

Known problems or uncertainties in this PR

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.42%. Comparing base (b6a55c2) to head (f21d625).
⚠️ Report is 28 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2020      +/-   ##
============================================
+ Coverage     70.07%   70.42%   +0.35%     
  Complexity     1703     1703              
============================================
  Files            34       34              
  Lines          4484     4436      -48     
============================================
- Hits           3142     3124      -18     
+ Misses         1342     1312      -30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@osma osma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself looks OK, but Cypress tests are still failing in CI for other reasons. (I restarted the tests to see if it helps)

@joelit
Copy link
Copy Markdown
Contributor Author

joelit commented Apr 24, 2026

I tried testing for the appearance and disappearance of the spinner as an indicator that the search results list is complete.

I kept the 5 -> 6 search result list, as it removes all possibility for needing to scroll and test for the spinner twice.

Edit: the spinner approach was also flagging with one CI-cypress test passing and one failing. Instead, I changed the test to waiting for the pagination rearch result API call to finish and then counting if the amount of results have changed from 5 to 6. That seemed to work.

@joelit joelit changed the title Changed to a simpler test case for loading more results Changed to asynchronous test case for loading more results Apr 24, 2026
@joelit joelit merged commit 2c1cf9e into main Apr 24, 2026
25 of 26 checks passed
@github-project-automation github-project-automation Bot moved this from Under review to Issue/PR closed in Skosmos 3.x Backlog Apr 24, 2026
@joelit joelit deleted the issue2019-fix-cypress-test-for-load-more-search-results branch April 24, 2026 10:26
@joelit joelit moved this from Funnel to Closed in NatLibFi Skosmos Backlog Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Issue/PR closed

Development

Successfully merging this pull request may close these issues.

Failing cypress test for search results page

2 participants